<template>
  <div @click="gotodetail">
    <!-- <router-link to="/detail"> -->
    <!-- <h5>每个商品</h5> -->
    <img :src="item.pic" alt="" />
    <h5>{{ item.title }}</h5>
    <!-- </router-link> -->
  </div>
</template>
<script>
export default {
  props: ["item"],
  methods: {
    gotodetail() {
      // alert("跳转详情页");
      // this.$router.push({ path: "/detail", query: { obj: this.item } });
      //跳转路由 path代表要跳转的路径  query代表跳转时候要携带的参数

      this.$router.push({ name: "detail", params: { obj: this.item } });
      //params传参的时候其他的都一样把 query换成params 这里只能用name
    },
  },
};
</script>
<style lang="scss"></style>
